#pragma once
#include "mytypes.h"

namespace poly
{
	// represents an animatable object
	class IDynamic
	{
	public:
		virtual void step( float dt ) = 0; // called on each step from Dynamics class
		virtual void render( float dt ) = 0; // called on each render from Dynamics class
	};

	// represents a constraint (collision, a force field, springs, sliders, ...)
	// gets called by Dynamics class on each step
	class IConstraint
	{
	public:
		virtual void apply( float dt ) = 0;
	};

	// represents the main simulation class
	// usage:
	// add pointers to the dynamic objects into the dynObjects set
	// add pointers to the constraints into the constraints set
	// call step on each framemove and render on each framerender
	class Dynamics
	{
	public:
		typedef std::set<IDynamic*> DynamicSet;
		typedef std::set<IConstraint*> ConstraintSet;

		Dynamics(){}

		void step( float dt );
		void render( float dt );

		ConstraintSet	constraints;
		DynamicSet		dynObjects;
	};
}
